<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
   <!-- 包含公共的JSP代码片段 -->
	
	

<title>无线点餐平台</title>

<base href="<%=basePath%>">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="${pageContext.request.contextPath}/sys/style/js/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/sys/style/js/page_common.js"></script>
<link href="${pageContext.request.contextPath}/sys/style/css/common_style_blue.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/sys/style/css/index_1.css" />
<script src="${pageContext.request.contextPath}/Customer/laydate/laydate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/sys/style/js/toastr.min.js"></script>
<link href="${pageContext.request.contextPath}/sys/style/css/toastr.css" rel="stylesheet" />
</head>
<body>

<!-- 页面标题 -->
<div id="TitleArea">
	<div id="TitleArea_Head"></div>
	<div id="TitleArea_Title">
		<div id="TitleArea_Title_Content">
		
          	<img border="0" width="13" height="13" src="style/images/title_arrow.gif"/> 更新餐桌
										
		</div>
    </div>
	<div id="TitleArea_End"></div>
</div>

<!-- 主内容区域（数据列表或表单显示） -->
<div id="MainArea">
	<!-- 表单内容 -->
	<form action="${pageContext.request.contextPath}/update_Update.action" method="post" enctype="multipart/form-data" onSubmit="return myCheck()" >
		<!-- 本段标题（分段标题） -->
		<div class="ItemBlock_Title">
        	<img width="4" height="7" border="0" src="style/images/item_point.gif"> 餐桌信息&nbsp;
        </div>
        
		<!-- 本段表单字段 -->
        <div class="ItemBlockBorder">
            <div class="ItemBlock">
				<div class="ItemBlock2">
					 <table class="MainArea_Content" cellspacing="0" cellpadding="0">
                       <thead>
			            <tr align="center" valign="middle" id="TableTitle">
							<td>编号</td>
							<td>桌名</td>
							<td>状态</td>
							<td>预定时间</td>
							<td>类型</td>				
						</tr>
				       </thead>	
					
             <tbody id="TableData">
             <!-- 用迭代器在list链表里获取动态数据 ，value指取出action里面的变量为list(不可变)，var与下面的value配对，需要加#号-->
			 <s:iterator value="list" var="desk" >
			   <tr>                <!-- 用ognl表达式获取数据库动态数据并显示在页面 -->
				<td align="center"><input type="text" readOnly="true" name="id" value="<s:property value="#desk.t_id"/>"  /> </td>
		        <td align="center"><input id="mingzi" type="text" name="name" value="<s:property value="#desk.t_name"/>" />  </td>
				<td align="center"><input id="zt" type="text" name="status" value="<s:property value="#desk.t_status"/>" /> </td>
				<td align="center"><input id="time" placeholder="请输入日期" class="laydate-icon" onclick="laydate()" type="text" name="time" value="<s:property value="#desk.t_time"/>" /> </td>
				<td align="center"><input id="leixing" type="text" name="type" value="<s:property value="#desk.t_type"/>" /> </td>
				<td align="center" with="6%"></td>				
			   </tr>
			 </s:iterator>						
            </tbody>
					</table>
				</div>
            </div>
        </div>
		
		
		<!-- 表单操作 -->           <!-- css样式:绝对定位 -->
		<div id="InputDetailBar" style="position:absolute;left:170px;top:150px;">
		         
				 <input type="submit" value="修改" class="FunctionButtonInput">
        
                 <a href="javascript:history.go(-1);" class="FunctionButton">返回</a>
        </div>
	</form>
</div>

<script type="text/javascript">
  
           laydate({
           elem: '#demo'
                 })
                 
     
      toastr.options.positionClass = 'toast-bottom-right'; //初始化 toastr 提示插件
			 /* toastr.success('提交数据成功');
				toastr.error('Error');
				toastr.warning('只能选择一行进行编辑');
				toastr.info('info'); */
             toastr.options = {  
							        closeButton: false,  
							        debug: false,  
							        progressBar: true,  
							        positionClass: "toast-top-full-width",  
							        onclick: null,  
							        showDuration: "100",  
							        hideDuration: "500",  
							        extendedTimeOut: "1000",  
							        showEasing: "swing",  
							        hideEasing: "linear",  
							        showMethod: "fadeIn",  
							        hideMethod: "fadeOut", 
							        timeOut: "1000" 
							    };    
               
                             
    		function myCheck()
			{		
			
			    var p=1;
				
				if(document.getElementById("mingzi").value=="")
				{	
					toastr.error("桌名不能为空!");					
					return false;
				}
				else
				{
					var zm = document.getElementById("mingzi").value;
					if(zm=="东桌"||zm=="南桌"||zm=="西桌"||zm=="北桌")
					{}	
					else
					{
						toastr.error("桌名必须为东桌、西桌、南卓或者北桌!");
						return false;
					}
				}
								
				if(document.getElementById("zt").value=="")
				{
				    toastr.error("状态一定不能为空!");
					return false;
				}
				else
				{
					var zt = document.getElementById("zt").value;
					console.log(zt);
					if(zt=="1"||zt=="0")
					{}	
					else
					{
						toastr.error("状态必须为0或者1!");
						return false;
					}
				}	
							
				if(document.getElementById("time").value=="")
				{
				    toastr.error("时间不能为空!");
					return false;
				}
				
				if(document.getElementById("leixing").value=="")
				{	
					toastr.error("类型不能为空!");
					return false;
				}
				else
				{
					var leixing = document.getElementById("leixing").value;
					if(leixing=="小桌"||leixing=="大桌"||leixing=="vip桌")
					{}	
					else
					{
						toastr.error("类型必须为小桌、大桌或者vip桌!");
						return false;
					}
				}

				return true;
			}             
  

</script>

</body>
</html>
